-
  var svgPluginGlobals = {
    stepSVGmemo: {}
  }

mixin stepSVG(step, svgPath)
    //- Allows to import progressive (=animated) SVGs into slideshow.
    //- If a SVG has elements with a ``steps`` attributes, then
    //- ``+stepSVG(4, 'my.svg')`` with only display this element if 4 is
    //- included into ``steps``.
    
    -
      svgPath = path.join(basedir, svgPath)
      if (!svgPluginGlobals.stepSVGmemo[svgPath]) {
        var text = fs.readFileSync(svgPath, 'utf8')
        svgPluginGlobals.stepSVGmemo[svgPath] = cheerio.load(text, {xmlMode: true})
      }
      var parsed = svgPluginGlobals.stepSVGmemo[svgPath]
      var replacements = []
      parsed('*[steps]').each(function (i, c) {
        var steps = c.attribs.steps
        if (steps.indexOf('--') > -1) {
           var [min, max] = steps.split("--")
           min =  (min === '') ? 0 : parseInt(min)
           max =  (max === '') ? 10000 : parseInt(max)
           if ((step < min) || (step > max)) {
             var replacement = cheerio.load('<g></g>', {xmlMode: true}).root()
             var element = parsed(this)
             replacements.push([replacement, element])
             element.replaceWith(replacement)
           }
        } else if (c.attribs.steps.split(',').indexOf(step.toString()) === -1) {
          var replacement = cheerio.load('<g></g>', {xmlMode: true}).root()
          var element = parsed(this)
          replacements.push([replacement, element])
          element.replaceWith(replacement)
        }
      })
      var html = parsed.xml()
      replacements.map(function (rep) {
          rep[0].replaceWith(rep[1])
      })
    div(width="100%")!= html
